﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="UncleBobWebService.Models" %>

<!DOCTYPE html>

<html>
<head id="ApplicantJobList" runat="server">
    <title>Job List</title>
    <link href="/Theme/UncleBobTheme.css" rel="Stylesheet" />
</head>

<body>
<h2>Job List</h2>
    <div class="body">

        <!-- Form Begin -->
        <% using (Html.BeginForm("FormAction", "ApplicantJobList", FormMethod.Post))
           {%>
            <div class="table-box">
                <div class="left-justify">
                    <div class="table">
                        <div class="row">
                            <span class="cell" style="font-weight:bold;">ID</span>
                            <span class="cell" style="font-weight:bold;">Title</span>
                            <span class="cell" style="font-weight:bold;">Location</span>
                            <span class="cell" style="font-weight:bold;">Salary</span>
                            <span class="cell" style="font-weight:bold;">Description</span>
                            <span class="cell" style="font-weight:bold;">Positions</span>
                            <span class="cell" style="font-weight:bold;">Select</span>
                        </div>
                        <br />

                        <!-- Display all the jobs -->
                        <% int count = 0; %>
                             
                        <% foreach (JobModel job in Model) {%>
                        <div class="row">
                            <span class="cell"><%=Html.DisplayFor(model => job.ID)%></span>
                            <span class="cell"><%=Html.DisplayFor(model => job.Title)%></span> 
                            <span class="cell"><%=Html.DisplayFor(model => job.Location)%></span> 
                            <span class="cell"><%=Html.DisplayFor(model => job.Salary)%></span> 
                            <span class="cell"><%=Html.DisplayFor(model => job.Description)%></span>
                            <span class="cell"><%=Html.DisplayFor(model => job.PositionsAvailable)%></span>

                            <!-- make sure the first Radio button is always selected by default -->
                            <% if (0 == count) {%>
                                <span class="cell"><%=Html.RadioButton("answer", job.Title, true)%></span>
                            <%}%>
                            <% else {%>
                                <span class="cell"><%=Html.RadioButton("answer", job.Title)%></span>
                            <%}%>

                        </div>
                        <br />

                        <% ++count; %>

                        <%}%>
                    </div>   
                </div>
            </div>

            <!-- Buttons -->
            <input class="button" type="submit" name="previous" value="Previous" />
            <input class="button" type="submit" name="apply" value="Apply" />
        <%}%>

    </div>
</body>

</html>
